@extends('admin.layouts.application')

@section('title')
    <title>修改商户</title>
@stop

@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改商户</h5>
                </div>
                <div class="ibox-content">
                    @include('admin.layouts.msg')
                    <form class="form-horizontal m-t" action="{{route('admin.agent.edit')}}"
                          method="post">
                        {{csrf_field()}}
                        <div class="form-group">
                            <label class="col-sm-3 control-label">登录邮箱：</label>
                            <div class="col-sm-2">
                                <input value="{{$emails}}" required name="email" class="form-control"
                                       type="email">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码：(填写则重置密码)</label>
                            <div class="col-sm-2">
                                <input value="" min="6" max="20" name="password" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">商户名：</label>
                            <div class="col-sm-2">
                                <input value="{{$agent->name}}" min="1" max="20" required name="name"
                                       class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">手机号：</label>
                            <div class="col-sm-2">
                                <input value="{{$agent->phone}}" min="1" required name="phone" class="form-control"
                                       type="phone">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">代理费：</label>
                            <div class="col-sm-2">
                                <input value="{{$agent->price}}" min="1" required name="price" class="form-control"
                                       type="number">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">游戏代理：</label>
                            <div class="col-sm-9">
                                @foreach($games as $game)
                                    <label for="{{$game->game_code}}" class="checkbox-inline">
                                        <input type="checkbox" name="game[]"
                                               @if(array_key_exists($game->id,$check))
                                               checked
                                               @endif
                                               id="{{$game->game_code}}"
                                               value="{{$game->id}}">{{$game->name}}
                                    </label>
                                @endforeach
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">机器人数量：</label>
                            <div class="col-sm-2">
                                <input value="{{$agent->agent_config->robot_num}}" min="0" required name="robot_num"
                                       class="form-control"
                                       type="number">
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{{$agent->id}}">
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">
                                    提交
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection
